<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./../../../WEB-INF/templates/noFooterCompanyTemplate.xhtml">

            <ui:define name="content">
                <h:form id="newFolderForm">
                    <p:dialog modal="true" resizable="false" widgetVar="newFolderDialog" id="newFolderDialog" header="#{messages.NewFolder}">
                        <p:panel styleClass="noBorder" id="newFolderPanel">
                            <h:panelGrid styleClass="createCandidatePanelGrid noMargin noPadding noBorder" id="newFolderPanelGrid" columns="1">
                                <p:inputText id="name" required="true" value="#{folderListBean.newFolder.description}" requiredMessage="#{messages.NameRequired}" label="#{messages.Name}">  
                                    <p:ajax event="change" update=":folderListForm:folderListGrowl" />
                                </p:inputText>  
                                <p:watermark for="name" value="#{messages.Name}" />
                                <p:commandButton process="@this" style="margin-top: 30px;" styleClass="formButton interestBackgroundButton" value="#{messages.Create}" oncomplete="newFolderDialog.hide()" update=":folderListForm:folderListGrowl :folderListForm:foldersDataGrid" id="createFolderButton" action="#{folderListBean.createNewFolder}" />                        
                            </h:panelGrid>
                        </p:panel>
                    </p:dialog>
                </h:form>
                
                
                <h:form id="folderListForm">
                    <p:growl id="folderListGrowl"></p:growl>
                    <p:dialog resizable="false" widgetVar="folderDetailDialog" modal="true" id="folderDetailDialog">
                        <p:panel id="updateFacesPanel" styleClass="previewDialogPanel noMargin noPadding noBorder">
                            <p:panel styleClass="noBorder noMargin noPadding" rendered="#{folderListBean.chosenEntity!=null}">
                                <div style="margin-top:-14px;margin-bottom: 15px;">
                                    <h:outputText styleClass="viewCandidateLabel" value="#{folderListBean.chosenEntity.description}"></h:outputText>
                                </div>
                                <p:dataGrid styleClass="noBorder noMargin noPadding previewFacesDataGrid" emptyMessage="#{messages.NoCandidatesInFolder}" id="facesDataGrid" var="companyAdquiredProfile" value="#{folderListBean.previewCandidateList}" columns="3" rows="#{folderListBean.previewCandidateList.size()}" paginator="false" >
                                    <p:column styleClass="facesColumn noPadding noMargin noBorder">
                                        <p:panel style="margin-left: 4px;" id="hola" styleClass="noPadding noBorder previewFacesPanel polaroidBackground rotate#{polaroidBean.randomRotation}">  
                                            <h:panelGrid columns="1" styleClass="noMargin noPadding noBorder facesPanel">  
                                                <h:graphicImage rendered="#{companyAdquiredProfile.candidate.bustColor==null}" styleClass="imagenBusqueda" library="images" name="bustnotavailable.jpg"></h:graphicImage>                            
                                                <h:graphicImage rendered="#{companyAdquiredProfile.candidate.bustColor!=null}" styleClass="imagenBusqueda" value="/candidateFiles/#{companyAdquiredProfile.candidate.idCandidate.toString()}/images/#{companyAdquiredProfile.candidate.bustColor}"></h:graphicImage>                            
                                                <h:outputText styleClass="polaroidText" value="#{companyAdquiredProfile.candidate.name}, #{companyAdquiredProfile.candidate.yearsOld}"></h:outputText>
                                            </h:panelGrid>  
                                        </p:panel> 
                                    </p:column>
                                </p:dataGrid>
                                <h:panelGrid styleClass="noBorder allWidth marginBottom20 marginTop20" columns="2">
                                    <p:commandButton process="@this" update="foldersDataGrid folderDetailDialog updateFacesPanel" actionListener="#{folderListBean.deleteChosenEntity()}" style="margin-left: 5px;" styleClass="cropButton interestBackgroundButton" value="#{messages.Remove}" rendered="#{folderListBean.chosenEntity.companyFolderType.idCompanyFolderType!=2}"></p:commandButton>
                                    <p:commandButton process="@this" action="#{folderListBean.redirectToViewEntity}" styleClass="cropButton imageBackgroundButton floatRight" style="margin-right: 15px;" value="#{messages.FolderCandidates}"></p:commandButton>
                                </h:panelGrid>
                            </p:panel>
                        </p:panel>
                    </p:dialog>
                    
                    <p:panel styleClass="noMargin noPadding noBorder facesWrapPanel">
                        <p:panel styleClass="noBorder noPadding noMargin inlineBlock leftColumnList">
                            <p:commandLink onclick="newFolderDialog.show();" styleClass="newFolderIcon leftColumnActionButton">
                                <h:outputText styleClass="editIconText" value="#{messages.NewFolder}"></h:outputText>
                            </p:commandLink>
                            <p:panel header="#{messages.NewFolder}" styleClass="noMargin noPadding noBorder inlineBlock leftColumnTip noPaddingTitle titleRight">
                                <h:outputText styleClass="bodyText" value="#{messages.NewFolderText}"></h:outputText>
                            </p:panel>
                            <p:commandLink process="@this" action="#{folderListBean.viewAllProfiles()}" styleClass="seeAllProfilesIcon leftColumnActionButton">
                                <h:outputText styleClass="editIconText" value="#{messages.AllProfiles}"></h:outputText>
                            </p:commandLink>
                            <p:panel header="#{messages.AllProfiles}" styleClass="noMargin noPadding noBorder inlineBlock leftColumnTip noPaddingTitle titleRight">
                                <h:outputText styleClass="bodyText" value="#{messages.AllProfilesText}"></h:outputText>
                            </p:panel>
                        </p:panel>
                        
                        <p:panel id="tep" styleClass="noBorder noPadding noMargin inlineBlock rightColumnList rightColumnListPanel">
                            <p:dataGrid emptyMessage="" styleClass="noBorder noMargin noPadding" id="foldersDataGrid" var="folder" value="#{folderListBean.entityList}" columns="4" rows="#{folderListBean.entityList.size()}" paginator="false" >
                                <p:panel styleClass="noMargin noPadding noBorder folderPanel folderType#{folder.companyFolderType.idCompanyFolderType}">  
                                    <h:panelGrid columns="1" styleClass="noMargin noPadding noBorder allWidth center listInnerPanelGrid">  
                                        <p:commandLink update=":folderListForm:folderDetailDialog :folderListForm:updateFacesPanel" oncomplete="folderDetailDialog.show()" actionListener="#{folderListBean.setChosenEntity(folder)}" process="@parent">
                                            <h:graphicImage styleClass="imagenFolder" library="images" name="white-folder.png"></h:graphicImage>                            
                                        </p:commandLink>
                                        <p:inplace styleClass="folderInplace" editor="true" rendered="#{folder.companyFolderType.idCompanyFolderType!=2}" >  
                                            <p:ajax event="save" listener="#{folderListBean.editFolderName(folder)}"></p:ajax>
                                            <p:inputText value="#{folder.description}" required="true" label="text"/>  
                                        </p:inplace>  
                                        <p:outputLabel value="#{folder.description}" rendered="#{folder.companyFolderType.idCompanyFolderType==2}"></p:outputLabel>
                                    </h:panelGrid>  
                                </p:panel> 
                            </p:dataGrid>
                        </p:panel>
                    </p:panel>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
